 //*代理功能相关js*/

 //关闭代理提示
        if (window.localStorage &&  localStorage.getItem("agentHint") == 'true'){
            $('.agent-hint').hide();
        }
        $('.confirm-hint').click(function(){
            $('.agent-hint').fadeOut(200);
            window.localStorage && localStorage.setItem("agentHint",true)
        })
$(".account-number").click(function (){
        var url = '/agent/getCustomers';
        var uid = $(this).attr('data-uid');
        var str = '';
        var login_uid = CONFIG['uid'];
        $("#append-company").empty();
        $.get(url,{uid:uid},function (res){
            for(var i in res['data']) {
                if (res['data'][i]['com_uid'] == login_uid) {
                    str += '<li class="on" data-uid="'+res['data'][i]['com_uid']+'">'+res['data'][i]['customer']+'<i></i></li>';
                } else {
                    str += '<li data-uid="'+res['data'][i]['com_uid']+'">'+res['data'][i]['customer']+'<i></i></li>';
                }
            }
            $("#append-company").html(str);
            $(".agency-pop").show();
            $(".winpopbg").show();

        },'json');
    });

    $(".Rigmidle-ovflblick").click(function (){
    //$(".agent-show,.agent-account").click(function (){
        var url = '/agent/getCustomers';
        var uid = $(this).attr('data-uid');
        var str = '';
        var login_uid = CONFIG['uid'];
        $("#append-company").empty();
        $.get(url,{uid:uid},function (res){
            for(var i in res['data']) {
                if (res['data'][i]['com_uid'] == login_uid) {
                    str += '<li class="on" data-uid="'+res['data'][i]['com_uid']+'">'+res['data'][i]['customer']+'<i></i></li>';
                } else {
                    str += '<li data-uid="'+res['data'][i]['com_uid']+'">'+res['data'][i]['customer']+'<i></i></li>';
                }
            }
            $("#append-company").html(str);
            $(".winpopbg").show();
            $(".agency-pop").show();

        },'json');
    });

    // 鍒囨崲鐧诲綍鐢ㄦ埛
    var agentSwitch = true;
    $(document).on('click','#append-company li',function () {
    	if (agentSwitch) {
	    	agentSwitch = false;
	        $('#append-company li').removeClass();
	        $(this).addClass('on');
	        $("#change-msg").show();
	        var url   = '/agent/changeUser';
	        var uid   = $(this).attr('data-uid');
	        var count = 3;
	        var timer1 = setInterval(function  () {
	            count--;
	            $("#change-msg").html(' '+count+" 秒后切换到该账号");
	        },1000);
	        var timer = setTimeout(function () {
	            clearInterval(timer1);
	            $.get(url,{uid:uid},function (res){
	                if (res['status']) {
	                    location.reload();
	                }
	            });
	        },3000);
    	}
    });
    $(".agency-pop .fr").click(function () {
        $(".agency-pop").hide();
        $(".winpopbg").hide();
    });

    function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var company = '';
if (company) {
    $(".agent-company a").html(decodeURI(company));
    $(".agent-company a").attr('title', decodeURI(company));
} else {
    uid = CONFIG['uid'];
    $.get('/agent/getCompany', _defineProperty({ uid: uid }, "uid", uid), function (res) {
        if (res['status'] == 1) {
            $(".agent-company a,.agent-account .size").html(res['user']['customer']);
        }
    });
}